<template>
    <div>
      <el-form :inline="true" :model="warehouseDetailsInfo" class="demo-form-inline">
        <el-form-item label="仓库名称">
          <el-input v-model="warehouseInfo.warName" readonly></el-input>
        </el-form-item>
        <el-form-item label="最大存储值">
          <template>
            <el-input-number v-model="warehouseDetailsInfo.maxNum" :min="1" :max="warehouseInfo.maximumStorageQuantity"></el-input-number>
          </template>
        </el-form-item>
        <el-form-item label="最小存储值">
          <template>
            <el-input-number v-model="warehouseDetailsInfo.minNum" :min="0" :max="warehouseInfo.maximumStorageQuantity"></el-input-number>
          </template>
        </el-form-item>
      </el-form>
    </div>
</template>

<script>
    export default {
        name: "designatedWarehouse_T2dialog",
        data(){
          return {
            warehouseInfo:{},
            warehouseDetailsInfo:{
              pid:"",
              maxNum:1,
              minNum:0
            }
          }
        },
        methods:{
          getData(id){
            //调用异步，根据id，获取仓库对象
            this.$axios.get("warehouseInfo/queryWarehouseInfoById.action/"+id,null).
            then(response=>{
              this.warehouseInfo=response.data;
            }).
            catch();
            //将传来的仓库id存入对象内
            this.warehouseDetailsInfo.pid=id;
            //获取父组件的商品id
            this.warehouseDetailsInfo.shopId=this.$parent.$parent.$parent.shopId;
            //获取父组件的供应商id
            this.warehouseDetailsInfo.uid=this.$parent.$parent.$parent.supplierId;
          },
          submit(){
            //调用异步，进行仓库详情表添加
            this.$axios.put("warehouseDetailsInfo/configWarehouseInfo.action",this.warehouseDetailsInfo)
              .then(res=>{
                if(res.data.x){
                  this.$message.success(res.data.msg);
                }else {
                  this.$message.error(res.data.msg);
                }
                //调用父组件函数，重新刷新一次数据
                this.$parent.$parent.$parent.getData();
              })
              .catch(err=>{
                this.$message.warning(err);
                alert(err);
              })
          }
        }
    }
</script>

<style scoped>

</style>
